<?php

namespace App\Observers;

use App\Models\PhoneNumber;
use Illuminate\Support\Carbon;

class PhoneNumberObserver
{
    /**
     * Handle the device "created" event.
     *
     * @param \App\Models\PhoneNumber $device
     * @return void
     */
    public function created(PhoneNumber $device)
    {
        //
    }

    /**
     * Handle the device "updated" event.
     *
     * @param \App\Models\PhoneNumber $device
     * @return void
     */
    public function updated(PhoneNumber $device)
    {
        //
    }

    /**
     * Handle the device "deleted" event.
     *
     * @param \App\Models\PhoneNumber $device
     * @return void
     */
    public function deleted(PhoneNumber $device)
    {
        //
    }

    /**
     * Handle the device "restored" event.
     *
     * @param \App\Models\PhoneNumber $device
     * @return void
     */
    public function restored(PhoneNumber $device)
    {
        //
    }

    /**
     * Handle the device "force deleted" event.
     *
     * @param \App\Models\PhoneNumber $device
     * @return void
     */
    public function forceDeleted(PhoneNumber $device)
    {
        //
    }

    public function creating(PhoneNumber $model)
    {
//        $model->created_at = Carbon::now();
        $model->code = uniqid();
    }

    public function saving(PhoneNumber $model)
    {
/*        if ($model->device) {
            if ($model->imei_1) $model->device->imei_1 = $model->imei_1;
            if ($model->imei_2) $model->device->imei_2 = $model->imei_2;
        }*/
    }
}
